<template>
	<StandardStreamContainer id="ajax-demo">
		<el-form :model="loginForm" label-width="120px">
			<el-form-item label="userName"><el-input v-model="loginForm.userName" /></el-form-item>
			<el-form-item label="passWord"><el-input v-model="loginForm.passWord" /></el-form-item>
			<el-form-item label="strArr">
				<el-checkbox-group v-model="loginForm.strArr" size="small">
					<el-checkbox-button label="Listen to me">听我说</el-checkbox-button>
					<el-checkbox-button label="thank you">谢谢你</el-checkbox-button>
					<el-checkbox-button label="Because of you">因为有你</el-checkbox-button>
					<el-checkbox-button label="Warm the four seasons">温暖了四季</el-checkbox-button>
				</el-checkbox-group>
			</el-form-item>
			<el-form-item label="intArr">
				<el-checkbox-group v-model="loginForm.intArr" size="small">
					<el-checkbox-button :label="20020724">20020724</el-checkbox-button>
					<el-checkbox-button :label="-3456789">-3456789</el-checkbox-button>
					<el-checkbox-button :label="65535">65535</el-checkbox-button>
					<el-checkbox-button :label="789465132">789465132</el-checkbox-button>
				</el-checkbox-group>
			</el-form-item>
			<el-form-item label="strList">
				<el-checkbox-group v-model="loginForm.strList" size="small">
					<el-checkbox-button label="Listen to me">听我说</el-checkbox-button>
					<el-checkbox-button label="thank you">谢谢你</el-checkbox-button>
					<el-checkbox-button label="Because of you">因为有你</el-checkbox-button>
					<el-checkbox-button label="Warm the four seasons">温暖了四季</el-checkbox-button>
				</el-checkbox-group>
			</el-form-item>
			<el-form-item label="intList">
				<el-checkbox-group v-model="loginForm.intList" size="small">
					<el-checkbox-button :label="34567">34567</el-checkbox-button>
					<el-checkbox-button :label="-98765">-98765</el-checkbox-button>
					<el-checkbox-button :label="-789456">-789456</el-checkbox-button>
					<el-checkbox-button :label="3456789">3456789</el-checkbox-button>
				</el-checkbox-group>
			</el-form-item>
			<el-form-item label="mapList">{{ loginForm.mapList }}</el-form-item>
			<el-form-item label="map">{{ loginForm.map }}</el-form-item>
			<el-form-item label="itemList">{{ loginForm.itemList }}</el-form-item>
			<el-form-item label="item">{{ loginForm.item }}</el-form-item>
			<el-form-item label="intValue"><el-input v-model="loginForm.intValue" /></el-form-item>
			<el-form-item label="integerValue"><el-input v-model="loginForm.integerValue" /></el-form-item>
			<el-form-item label="shortValue"><el-input v-model="loginForm.shortValue" /></el-form-item>
			<el-form-item label="doubleValue"><el-input v-model="loginForm.doubleValue" /></el-form-item>
			<el-form-item label="floatValue"><el-input v-model="loginForm.floatValue" /></el-form-item>
			<el-form-item label="booleanValue"><el-switch v-model="loginForm.booleanValue" /></el-form-item>
			<el-form-item>
				<el-button type="primary" @click="get">get方法</el-button>
				<el-button type="primary" @click="post">post方法</el-button>
				<el-button type="primary" @click="sget">sget方法</el-button>
				<el-button type="primary" @click="spost">spost方法</el-button>
			</el-form-item>
		</el-form>
	</StandardStreamContainer>
</template>

<script>
import { BASE_URL, $get, $post, $POST } from '@/plugin/request.js';
import {$sget,$spost} from '@/plugin/socketRequest.js'
import { downloadFileByBlob, equals } from '@/utils/object';
import StandardStreamContainer from '@/layout/viewContainer/StandardStreamContainer.vue';
export default {
	data() {
		return {
			loginForm: {
				userName: 'admin',
				passWord: 'qwertyuiop',
				strArr: ['Listen to me', 'Because of you'],
				intArr: [65535, 20020724],
				strList: ['thank you', 'Warm the four seasons'],
				intList: [-98765, 3456789],
				mapList: [
					{
						int: 0x80000000,
						string: 'string',
						short: -32768,
						double: 3.1415926535,
						float: 0.618
					},
					{
						int: 0x7fffffff,
						string: 'string',
						short: 32767,
						double: 3.1415926535,
						float: 0.618
					}
				],
				map: {
					first: '听我说',
					second: '谢谢你',
					third: ['因为有你', '温暖了四季'],
					four: {
						a: '以为你',
						b: '感谢有你',
						c: '世界更美丽',
						five: [{ text: '我要谢谢你' }, { text: '因为有你' }, '把幸福传递']
					}
				},
				itemList: [
					{
						id: 'GB-2312',
						age: 1984
					},
					{
						id: 'GBK',
						age: 1999
					},
					{
						id: 'UTF-8',
						age: 1950
					}
				],
				item: {
					id: 'GB-2312',
					age: 1984
				},
				intValue: -0x80000000,
				integerValue: 0x7fffffff,
				shortValue: 6789,
				doubleValue: 3.1415926535,
				floatValue: -0.618,
				booleanValue: true
			},
			BASE_URL
		};
	},
	created() {
		let money=10000
		let year=5
		let obj=[
			{
				title:'一周一投',
				d:0.01,
				count:48,
				l:1-0.15
			},
			{
				title:'一个月一投',
				d:0.04,
				count:12,
				l:1-0.075
			},{
				title:'二个月一投',
				d:0.10,
				count:6,
				l:1-0.05
			},{
				title:'三个月一投',
				d:0.15,
				count:4,
				l:1
			},{
				title:'四个月一投',
				d:0.2,
				count:3,
				l:1
			},{
				title:'六个月一投',
				d:0.3,
				count:2,
				l:1
			},{
				title:'一年一投',
				d:0.4,
				count:1,
				l:1
			}
		]
		let t=[]
		obj.forEach(item=>{
			let m=money
			let lx=0
			for (let i = 0; i < item.count*year; i++) {
				let lr=m*item.d
				lx+=m*item.d*(1-item.l)
				lr*=item.l
				m+=lr
			}
			t.push({
				"投资类型":item.title,
				"投入金额":money,
				"周期利益":item.d*100+"%",
				"周期利息率":(100-item.l*100)/100+"%",
				"生产金额":Math.ceil(m),
				"年均":Math.ceil(m/5),
				"扣除的利息":Math.ceil(lx)
			})
		})
		console.table(t)
	},
	methods: {
		get() {
			$get('/getTestForm', this.loginForm).then(res => {
				console.log(res);
			});
		},
		post() {
			$post('/postTestForm', this.loginForm).then(res => {
				console.log(res);
			});
		},
		sget(){
			$sget('/getTestForm', this.loginForm).then(res => {
				console.log(res);
			});
		},
		spost(){
			$spost('/postTestForm', this.loginForm).then(res => {
				console.log(res);
			});
		}
	},
	components:{
		StandardStreamContainer
	}
};
</script>

<style></style>
